﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability_Management.Domain;
using Traceability_Management.ErrorCode;
using Traceability_Management.Read.Api.Application.Command.ThreeSelectWay;

namespace Traceability_Management.Read.Api.Controllers
{
    [Route("api/[controller]/[action]/[action]")]
    [ApiController]
    public class ThreeSelectAllController : ControllerBase
    {
        IMediator mediator;

        public ThreeSelectAllController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public async Task<ApiResult<List<Slaughts_Sheng>>> TreeSheng([FromQuery]ShowShengCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<List<Slaughts_City>>> TreeCity([FromQuery] ShowCityCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<List<Slaughts_Xian>>> TreeXian([FromQuery] ShowXianCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
